package com.hulytu.invasion.component;

import com.hulytu.invasion.Elm;
import com.hulytu.invasion.Planet;

public abstract class BaseElm implements Elm {

    private Elm next;

    @Override
    public Planet planet() {
        return next == null ? Planet.DEFAULT : next.planet();
    }

    @Override
    public void setNext(Elm next) {
        Elm elm = this.next;
        if (elm == null) this.next = next;
        else elm.setNext(next);
    }

    @Override
    public Elm next() {
        return next;
    }
}
